﻿using IronLua.Metadata;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IronLua
{
    internal sealed class Closure
        : ILuaDynamicObject
    {

        private Prototype proto;
        private Value[] upvalues;

        public Closure(Prototype proto)
            : this(proto, Enumerable.Empty<Value>())
        {

        }

        public Closure(Prototype proto, IEnumerable<Value> upvalues)
        {
            this.proto = proto;
            this.upvalues = upvalues.ToArray();
        }

        public Prototype    Prototype { get { return this.proto; } }
        public IList<Value> UpValues { get { return this.upvalues; } }

        ValueType   ILuaDynamicObject.Type { get { return ValueType.Function; } }
        ITable      ILuaDynamicObject.Metatable { get; set; }


    }
}
